package com.sikaryofficial.backend.domain.dto.resp;

import com.sikaryofficial.backend.constant.ContentStatusEnum;
import com.sikaryofficial.backend.domain.vo.store.StoreEvaluateExtObj;
import com.sikaryofficial.common.core.annotation.LocalDateTimeFormat;
import com.sikaryofficial.system.api.model.att.AttachmentResp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * 店铺
 *
 * @author qinjinyuan
 * @date 2023-10-30
 */
@Getter
@Setter
@ToString
@ApiModel(value = "店铺列表出参", description = "店铺列表出参")
public class StoreListDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "序号")
    private int seqNo;
    /**
     * 状态
     */
    @ApiModelProperty(value = "状态 0-正常 1-屏蔽 2-举报")
    private int status;
    /**
     * 是否屏蔽：0-否，1-是，默认未屏蔽
     */
    private Integer hasBlocked;
    /**
     * 店铺ID
     */
    @ApiModelProperty(value = "店铺ID", example = "222222222233333")
    private Long storeId;
    /**
     * 数据来源：manual-手工; shared-分享
     */
    @ApiModelProperty(value = "数据来源：manual-手工; evaluate-评价")
    private String sourceCode;
    /**
     * 店铺图片地址
     */
    @ApiModelProperty(value = "店铺图片地址", example = "12.2435")
    private String imageUrl;
    /**
     * 店铺名称
     */
    @ApiModelProperty(value = "店铺名称", example = "12.2435")
    private String storeName;
    /**
     * 总评分(1~5星正整数)
     */
    @ApiModelProperty(value = "总评分", example = "12.2435")
    private BigDecimal score;
    /**
     * 店铺地址
     */
    @ApiModelProperty(value = "店铺地址", example = "12.2435")
    private String address;
    /**
     * 店铺地址ID
     */
    @ApiModelProperty(value = "地址ID", example = "223344444")
    private Long addressId;
    /**
     * 经度
     */
    @ApiModelProperty(value = "经度", example = "12.2435")
    private Double longitude;
    /**
     * 纬度
     */
    @ApiModelProperty(value = "纬度", example = "12.2435")
    private Double latitude;
    /**
     * 评语
     */
    @ApiModelProperty(value = "评语", example = "12.2435")
    private String remark;
    @ApiModelProperty(value = "md5")
    private String md5;
    /**
     * 店铺与当前位置距离
     */
    @ApiModelProperty(value = "店铺与当前位置距离", example = "12.2435")
    private Double distance;

    /**
     * 店铺回访记录
     */
    @ApiModelProperty(value = "店铺回访记录")
    private List<StoreFollowDTO> storeFollows;

    @ApiModelProperty(value = "评价扩展对象")
    private StoreEvaluateExtObj extObj;

    /**
     * 附件列表
     */
    @ApiModelProperty(value = "附件列表")
    private List<AttachmentResp> attachmentList;
    /**
     * 创建人名字
     */
    @ApiModelProperty(value = "创建人名字")
    private String createdName;
    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    private Long createdBy;
    /**
     * 创建时间, 伦敦所在的时区为GMT+1，也被称为西一区
     */
    @LocalDateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间", example = "yyyy-MM-dd HH:mm:ss")
    private Date createdTime;
    @ApiModelProperty(value = "收藏统计", example = "123")
    private Integer collectionCount;
    /**
     * 是否有我的收藏
     */
    @ApiModelProperty(value = "是否有我的收藏")
    private boolean hasOwnerCollection;
    /**
     * 店铺标签：1:专卖店;2:便利店
     */
    @ApiModelProperty(value = "店铺标签：1:专卖店;2:便利店", example = "1")
    private Integer shopType;
    /**
     * 国家
     */
    @ApiModelProperty(value = "国家")
    private String country;
    /**
     * 区域
     */
    @ApiModelProperty(value = "区域")
    private String area;
    /**
     * 城市
     */
    @ApiModelProperty(value = "城市")
    private String city;
    /**
     * 区县
     */
    @ApiModelProperty(value = "区县")
    private String county;

    public String getStatusDesc() {
        ContentStatusEnum statusEnum = ContentStatusEnum.getNameByCode(status);
        if (Objects.nonNull(statusEnum)) {
            return statusEnum.getName();
        }
        return "";
    }

}
